package cn.iocoder.yudao.module.promotion.dal.mysql.prizedraw;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.prizedraw.vo.PrizeDrawNumberRecordPageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.prizedraw.PrizeDrawNumberRecordDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 抽奖次数详细记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PrizeDrawNumberRecordMapper extends BaseMapperX<PrizeDrawNumberRecordDO> {

    default PageResult<PrizeDrawNumberRecordDO> selectPage(PrizeDrawNumberRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PrizeDrawNumberRecordDO>()
                .eqIfPresent(PrizeDrawNumberRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(PrizeDrawNumberRecordDO::getSettingType, reqVO.getSettingType())
                .eqIfPresent(PrizeDrawNumberRecordDO::getPoint, reqVO.getPoint())
                .betweenIfPresent(PrizeDrawNumberRecordDO::getSignDate, reqVO.getSignDate())
                .eqIfPresent(PrizeDrawNumberRecordDO::getSignNum, reqVO.getSignNum())
                .eqIfPresent(PrizeDrawNumberRecordDO::getPrizeDrawSettingBatchId, reqVO.getPrizeDrawSettingBatchId())
                .eqIfPresent(PrizeDrawNumberRecordDO::getSpuId, reqVO.getSpuId())
                .likeIfPresent(PrizeDrawNumberRecordDO::getSpuName, reqVO.getSpuName())
                .eqIfPresent(PrizeDrawNumberRecordDO::getSkuId, reqVO.getSkuId())
                .eqIfPresent(PrizeDrawNumberRecordDO::getIsEffect, reqVO.getIsEffect())
                .eqIfPresent(PrizeDrawNumberRecordDO::getIsObtained, reqVO.getIsObtained())
                .eqIfPresent(PrizeDrawNumberRecordDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(PrizeDrawNumberRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PrizeDrawNumberRecordDO::getPrizeDrawNumberRecordId));
    }

}